import socket

client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(("localhost", 5010))

while 1:
    data = client_socket.recv(512)
    print "RECIEVED:" , data
    if( data == 'closed'):
        client_socket.close()
        break
    else:
        data = raw_input("SEND( TYPE closed to Quit):")
        if data == 'closed' :
            client_socket.close()
            break
        else:
            client_socket.send(data)
